using System.Collections.Generic;
using MvcCms.Data;
using MvcCms.Data.Entities;

using MvcCms.Service.Cache;

namespace MvcCms.Service.CMSCode
{
    public class SearchService : ISearchService
    {
        #region Constructors

        private readonly Portal _currentPortal;
        private readonly ISearchRepository _searchRepository;

       
        public SearchService(ISearchRepository repository, ICacheService cacheService)
        {
            _searchRepository = repository;
            _currentPortal = cacheService.GetCurrentPortal();
        }

        #endregion

        #region Validation Methods

        #endregion

        #region ISearchService Members

        public IEnumerable<DTOSearchResult> Search(string term, bool usefulltext)
        {
            return _searchRepository.Search(term, usefulltext, _currentPortal);
        }

        #endregion
    }
}